{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
    <h2>{% if object %}编辑网关{% else %}添加网关{% endif %}</h2>
    <form method="post">
        {% csrf_token %}
        <div class="form-group">
            {{ form.name.label_tag }}
            {{ form.name }}
        </div>
        <div class="form-group">
            {{ form.ip_address.label_tag }}
            {{ form.ip_address }}
        </div>
        <div class="form-group">
            {{ form.mac_address.label_tag }}
            {{ form.mac_address }}
        </div>
        <div class="form-group">
            {{ form.location.label_tag }}
            {{ form.location }}
        </div>
        <div class="form-group">
            {{ form.status.label_tag }}
            {{ form.status }}
        </div>
        <div class="form-group">
            {{ form.firmware_version.label_tag }}
            {{ form.firmware_version }}
        </div>
        <div class="form-group">
            {{ form.notes.label_tag }}
            {{ form.notes }}
        </div>
        <button type="submit" class="btn btn-primary">保存</button>
        <a href="{% url 'gateway-list' %}" class="btn btn-secondary">取消</a>
    </form>
</div>
{% endblock %}